package com.blue.base.demo.controller;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

/**
 * 测试模板controller
 *
 * @author liulei
 * @version 1.0
 */
@Slf4j
@RestController
@RequestMapping("/test")
public class TestController {

    /**
     * sentinel限流测试
     */
    @GetMapping("sentinel")
    @SentinelResource(value = "test")
    public String test() throws InterruptedException {
        String param = "";
        Thread.sleep(3000);
        log.info("测试sentinel：{}", param);
        return param;
    }

    /**
     * 测试oauth
     */
    @GetMapping("oauth")
    public String oauth() {
        return "oauth";
    }
}
